<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #aa {
            width: 100px;
            height: 200px;
            background-color:palegreen
        }
    </style>
</head>

<body>
    <script>
       window.onload = function () {
            var dd = document.getElementById('aa');
            console.log(dd);
            function mystyle(obj, name) {
                if (window.getComputedStyle) {
                    return getComputedStyle(obj, null)[name]
                }
                else {
                    return obj.currentStyle[name]
                }
            }
            alert(mystyle(dd, "width"))
        }
    </script>
    <div id='aa'></div>
</body>

</html>